module(..., package.seeall)

require "nvm"
require "mqttOutMsgKeson"
require "getLbsLoc"
require "modbusrtu"
require "terminalSendTheme"
require "mqttInMsgKeson"
require "modbusrtu"
-- 初始化nvm获取配置参数
nvm.init("config.lua", true)

LoopReadOrNot = false
-- 其他参数初始化
local slaveaddr, instructions = "0x01", "0x03"

-- 设备端参数配置修改
local function timedAcquisitionOfPressure()
    --log.info("定时任务开启！")
    --[[ while mqttInMsgKeson.ParamSetOrNot do
        log.info("设置参数！！！！")
    end ]]
    if not mqttInMsgKeson.ParamSetOrNot  then
        --log.info("设置参数问题")
        LoopReadOrNot = true
        sys.taskInit(modbusrtu.Modbus_send, slaveaddr, instructions, "0x0000", "0x0013") -- 读取压力值
        LoopReadOrNot = false
    end
end

-- 循环定时器，5s执行一次log1函数
sys.timerLoopStart(timedAcquisitionOfPressure, 1300, mqttInMsgKeson.ParamSetOrNot)
--循环定时器，5s执行一次

